package com.kuang.single;

/**
 * @author Administrator
 * @date 2021/5/27 14:49
 * Description:饿汉式单例
 */
public class Hungry {
    //缺点：一上来就创建对象，造成资源浪费
    private byte[] data1 = new byte[1024*1024];
    private byte[] data2 = new byte[1024*1024];
    private byte[] data3 = new byte[1024*1024];

    private static final Hungry HUNGRY = new Hungry();

    private Hungry(){}

    public static Hungry getInstance() {
        return HUNGRY;
    }
}